# 栈的python实现
class myStack:
    def __init__(self):
        self.__stackList=[]
    def stackpush(self,item):
        self.__stackList.append(item)
    def stackpop(self):
        return self.__stackList.pop()
    def stackPeek(self):
        # 返回栈顶元素
        return self.__stackList[len(self.__stackList)-1]
    def stackIsEmpty(self):
        return self.__stackList==[]
    def stackSize(self):
        # 返回堆栈的大小
        return len(self.__stackList)

if __name__=='__main__':
    stack=myStack()
    stack.stackpush(10)
    print("当前堆栈是否为空",stack.stackIsEmpty())
    stack.stackpush(20)
    stack.stackpush(30)
    stack.stackpush(40)
    print(stack.stackPeek())
    print(stack.stackpop())
    print(stack.stackpop())
    print(stack.stackpop())
    print(stack.stackpop())
